/* global axios */
import ApiClient from './ApiClient'

class NotificationsAPI extends ApiClient {
  constructor () {
    super('notifications', { accountScoped: true })
  }

  get (page) {
    return axios.get(`${this.url}?page=${page}`)
  }

  getNotifications (contactId) {
    return axios.get(`${this.url}/${contactId}/notifications`)
  }

  getUnreadCount () {
    return axios.get(`${this.url}/unreadCount`)
  }

  read (primaryActorType, primaryActorId) {
    return axios.post(`${this.url}/readAll`, {
      primaryActorType: primaryActorType,
      primaryActorId: primaryActorId,
    })
  }

  readAll () {
    return axios.post(`${this.url}/readAll`)
  }
}

export default new NotificationsAPI()
